//
//  BaseCollectionViewCell.m
//  CommonFrame
//
//  Created by Bang-guo on 15/7/15.
//  Copyright (c) 2015年 guobang. All rights reserved.
//

#import "BaseCollectionViewCell.h"

@implementation BaseCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
//        [self createSubViews];
    }
    return self;
}

-(void)createSubViews {
    NSLog(@"1111111111111");
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    if ([@"on" isEqualToString:[userDefaults objectForKey:@"isNight"]]) {
        
        //    夜间模式
        self.backgroundColor=[UIColor lightGrayColor];
        
        
    } else {
        
        self.backgroundColor=[UIColor whiteColor];
        
        
    }
    
    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
    [notificationCenter addObserver:self selector:@selector(changeNight:) name:@"changeNight" object:nil];
    
    
}


-(void)changeNight:(NSNotification *)notification {
    
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    if ([@"on" isEqualToString:[userDefaults objectForKey:@"isNight"]]) {
        
        self.backgroundColor = [UIColor lightGrayColor];
    } else {
        
        self.backgroundColor = [UIColor whiteColor];
        
    }
    
}

@end
